package com.sduept.nwld.dataserver.controller.base.secondary;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;
import javax.faces.view.ViewScoped;
import javax.inject.Named;

import org.apache.commons.beanutils.BeanUtils;
import org.primefaces.event.CellEditEvent;
import org.primefaces.event.SelectEvent;
import org.primefaces.event.TabChangeEvent;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import org.springframework.beans.factory.annotation.Autowired;

import com.sduept.bigdata.document.core.CommonDocumentProperties;
import com.sduept.bigdata.web.jsf.controller.AbstractController;
import com.sduept.cim.model.core.PowerSystemResource;
import com.sduept.cim.model.core.Substation;
import com.sduept.cim.model.protection.ProtectionEquipment;
import com.sduept.cim.wave.service.ProtectCheckPersistManager;
import com.sduept.core.entity.IdentifiedObject;
import com.sduept.bigdata.weather.map.MapDataCache;
import com.sduept.nwld.dataserver.manager.protection.ProtectCheckQueryManager;
import com.sduept.utils.ExcelUtils;
import com.sduept.utils.PingYinUtil;
import com.sduept.utils.ZipUtil;

/**
 * 主保护数据配置错误的设备
 * @author ningfw
 * @date 2018-01-15
 *
 */
@Named
@ViewScoped
public class ProtectCheckQueryController extends AbstractController {
	@Autowired
	private CommonDocumentProperties pros;
	private static final long serialVersionUID = -7277688137603131355L;
	@Autowired
	private MapDataCache cc;
	@Autowired
	private ProtectCheckQueryManager protectCheckQueryManager;
	@Autowired
	private ProtectCheckPersistManager protectCheckPersistManager;
	private List<ProtectionEquipmentDTO> incorrectPro = new ArrayList<ProtectionEquipmentDTO>();// 线路主保护错误的数据
	private ProtectionEquipmentDTO selected = null;
	private ProtectionEquipmentDTO currentDevicePro;
	private List<String> proKinds = new ArrayList<String>();
	private StreamedContent protectFile;// 保护数据Excel流
	private String[] selectedTypes = new String[] { "line", "bus", "power", "breaker" };// 前台选择的要导出的excel的类型
	private String currentView;// 当前展示的菜单界面 line bus or power
	private String currentTab;// 当前展示的tab
	private int currentTabIndex;
	private List<String> tabTiltes = new ArrayList<String>();
	// 变电站
	private List<Substation> substations = new ArrayList<>();
	public Map<String, List<String>> cimstation = new HashMap<>();
	public Map<String, List<String>> primEquipments = new HashMap<>();// 一次设备
	private String deviceName;// 一次设备名称
	// 生产厂家
	public List<String> devManufacturers = new ArrayList<>();
	public Map<String, List<String>> devManufacturerMap = new HashMap<>();
	private List<String> protectedTypes = new ArrayList<>();// 一次设备类型

	/**
	 * 错误保护缓存，增加切换界面流畅度
	 */
	private Map<String, List<ProtectionEquipmentDTO>> cache = new HashMap<String, List<ProtectionEquipmentDTO>>();

	@PostConstruct
	public void init() {
		currentView = "line";// 第一次加载页面
		initTabTiles();
		if (tabTiltes.size() > 0)
			currentTab = tabTiltes.get(0);
		else
			currentTab = "无";
		proKinds.clear();
		initProKind();
		findIncorrectLinePro();// 查询线路主保护错误的数据

		// 初始化变电站
		substations = cc.getS500List();
		for (Substation r : substations) {
			String key = PingYinUtil.getPingYinHeader(r.getName());
			List<String> ss = cimstation.get(key);
			if (ss == null) {
				ss = new ArrayList<>();
				cimstation.put(key, ss);
			}
			ss.add(r.getName());
		}

		// 初始化一次设备
		List<?> allProtectedName = protectCheckQueryManager.queryAllProtectedName();
		for (Object object : allProtectedName) {
			String key = PingYinUtil.getPingYinHeader(object + "");
			List<String> ss = primEquipments.get(key);
			if (ss == null) {
				ss = new ArrayList<>();
				primEquipments.put(key, ss);
			}
			ss.add(object + "");
		}

		// 初始化生产厂家
		List<?> allDev = protectCheckQueryManager.queryAllDev();
		for (Object o : allDev) {
			devManufacturers.add(o.toString());
		}
		for (int i = 0; i < devManufacturers.size(); i++) {
			String key = PingYinUtil.getPingYinHeader(devManufacturers.get(i));
			List<String> ss = devManufacturerMap.get(key);
			if (ss == null) {
				ss = new ArrayList<>();
				devManufacturerMap.put(key, ss);
			}
			ss.add(devManufacturers.get(i));
		}

		// 初始化一次设备类型
		List<?> AllProtectedTypes = protectCheckQueryManager.queryAllProtectedTypes();
		for (Object o : AllProtectedTypes) {
			protectedTypes.add(o.toString());
		}
	}

	/**
	 * 打开线路保护编辑框
	 * @param dto
	 */
	public void openLineProEditDialog(ProtectionEquipmentDTO dto) {
		Map<String, List<String>> map = new HashMap<>();
		List<String> list1 = new ArrayList<String>();
		list1.add(currentView);
		map.put("viewType", list1);

		List<String> list2 = new ArrayList<String>();
		list2.add(dto.getProtectedId());
		map.put("protectedId", list2);

		Map<String, Object> options = new HashMap<String, Object>();
		options.put("width", 1450);
		options.put("height", 600);
		options.put("contentWidth", 1430);
		options.put("contentHeight", 580);
		openDialog("/ui/baseData/dialog/lineProDialog.xhtml", map, options);
	}

	/**
	 * 打开变电站内保护编辑框
	 * @param dto
	 */
	public void openStProEditDialog(ProtectionEquipmentDTO dto) {
		Map<String, List<String>> map = new HashMap<>();
		List<String> list1 = new ArrayList<String>();
		list1.add(currentView);
		map.put("viewType", list1);

		List<String> list2 = new ArrayList<String>();
		// 当protectedId 为Null 时会抛出空指针异常
		if (null != dto.getProtectedId()) {
			list2.add(dto.getProtectedId());
			map.put("protectedId", list2);
		} else {
			addErrorMessage("该厂站下无保护设备数据!");
			return;
		}

		List<String> list3 = new ArrayList<String>();
		list3.add(dto.getSubstationId());
		map.put("stationId", list3);

		Map<String, Object> options = new HashMap<String, Object>();
		options.put("width", 1450);
		options.put("height", 600);
		options.put("contentWidth", 1430);
		options.put("contentHeight", 580);
		openDialog("/ui/baseData/dialog/stationProDialog.xhtml", map, options);
	}

	/**
	 * 打开未关联变电站详情页面
	 * 未关联变电站名称超链接方法调用
	 * @param dto
	 */
	public void openUnbindProEditDialog(ProtectionEquipmentDTO dto) {
		Map<String, List<String>> map = new HashMap<>();
		List<String> list1 = new ArrayList<String>();
		list1.add(dto.getPrivateStationId());
		map.put("privateStationId", list1);
		List<String> list2 = new ArrayList<String>();
		list2.add(cnToUnicode(dto.getPrivateStationName()));
		map.put("privateStationName", list2);
		Map<String, Object> options = new HashMap<String, Object>();
		options.put("width", 1450);
		options.put("height", 600);
		options.put("contentWidth", 1430);
		options.put("contentHeight", 580);
		openDialog("/ui/baseData/dialog/unbindProDialog.xhtml", map, options);
	}

	// 中文转成unicode
	private static String cnToUnicode(String cn) {
		char[] chars = cn.toCharArray();
		StringBuilder returnStr = new StringBuilder();
		for (int i = 0; i < chars.length; i++) {
			returnStr.append("\\u" + Integer.toString(chars[i], 16));
		}
		return returnStr.toString();
	}

	/**
	 * 生成指定类型的保护错误信息
	 * @param type
	 */
	public void generateIncorrectProInfos(String type) {
		currentView = type;
		initTabTiles();
		if (currentTabIndex < tabTiltes.size())
			currentTab = tabTiltes.get(currentTabIndex);
		else
			currentTab = tabTiltes.get(0);
		if ("line".equals(type)) {
			findIncorrectLinePro();// 查询线路主保护错误的数据
		} else if ("bus".equals(type)) {
			findIncorrectBusPro();// 查询母线主保护错误的数据
		} else if ("power".equals(type)) {
			findIncorrectTransPro();// 查询变压器主保护错误的数据
		} else if ("breaker".equals(type)) {
			findIncorrectBreakerPro();// 查询变压器主保护错误的数据
		} else if ("unbindSt".equals(type)) {
			findUnbindStationPro();// 查询未绑定变电站保护设备
		} else if ("unbindEqu".equals(type)) {
			findUnbindPrimaryEquPro();// 查询未绑定一次设备保护
		}
	}

	public void onTabChange(TabChangeEvent event) {
		currentTab = event.getTab().getTitle();
		for (int i = 0; i < tabTiltes.size(); i++) {
			if (currentTab.equals(tabTiltes.get(i)))
				currentTabIndex = i;
		}
		if ("line".equals(currentView))
			findIncorrectLinePro();// 查询线路主保护错误的数据
		else if ("bus".equals(currentView))
			findIncorrectBusPro();// 查询母线主保护错误的数据
		else if ("power".equals(currentView))
			findIncorrectTransPro();// 查询变压器主保护错误的数据
		else if ("breaker".equals(currentView))
			findIncorrectBreakerPro();// 查询断路器保护错误的数据
		else if ("unbindSt".equals(currentView))
			findUnbindStationPro();// 查询未绑定变电站保护设备
		else if ("unbindEqu".equals(currentView))
			findUnbindPrimaryEquPro();// 查询未绑定一次设备保护

	}

	/**
	* 初始化tab
	*/
	private void initTabTiles() {
		tabTiltes.clear();
		if (currentView.startsWith("line")) {
			tabTiltes = protectCheckQueryManager.getLineIncorrectKinds();
		} else if (currentView.startsWith("bus")) {
			tabTiltes = protectCheckQueryManager.getBusIncorrectKinds();
		} else if (currentView.startsWith("power")) {
			tabTiltes = protectCheckQueryManager.getTransIncorrectKinds();
		} else if (currentView.equals("breaker")) {
			tabTiltes = protectCheckQueryManager.getBreakerIncorrectKinds();
		} else if (currentView.startsWith("unbindSt")) {
			tabTiltes = protectCheckQueryManager.getUnbindStKinds();
		} else if (currentView.startsWith("unbindEqu")) {
			tabTiltes = protectCheckQueryManager.getUnbindPrimaryKinds();
		}
	}

	private void initProKind() {
		proKinds.add("主一保护");
		proKinds.add("主二保护");
		proKinds.add("主三保护");
		proKinds.add("断路器保护");
		proKinds.add("辅A保护");
		proKinds.add("辅B保护");
		proKinds.add("非电量保护");
		proKinds.add("短引线保护");
	}

	/**
	 * 查询线路主保护错误的数据
	 * @return
	 */
	private void findIncorrectLinePro() {
		List<ProtectionEquipmentDTO> list = cache.get(currentView + "_" + currentTab);
		if (list == null) {
			for (String title : tabTiltes) {
				cache.put(currentView + "_" + title, new ArrayList<ProtectionEquipmentDTO>());
			}
			list = protectCheckQueryManager.getLineProtectIncorrectInfos();
			for (ProtectionEquipmentDTO d : list) {
				cache.get(currentView + "_" + d.getComment()).add(d);
			}
		}
		incorrectPro = cache.get(currentView + "_" + currentTab);
	}

	/**
	 * 查询母线主保护错误的数据
	 * @return
	 */
	private void findIncorrectBusPro() {
		List<ProtectionEquipmentDTO> list = cache.get(currentView + "_" + currentTab);
		if (list == null) {
			for (String title : tabTiltes) {
				cache.put(currentView + "_" + title, new ArrayList<ProtectionEquipmentDTO>());
			}
			list = protectCheckQueryManager.getBusProtectIncorrectInfos();
			for (ProtectionEquipmentDTO d : list) {
				cache.get(currentView + "_" + d.getComment()).add(d);
			}
		}
		incorrectPro = cache.get(currentView + "_" + currentTab);
	}

	/**
	 * 查询变压器主保护错误的数据
	 * @return
	 */
	private void findIncorrectTransPro() {
		List<ProtectionEquipmentDTO> list = cache.get(currentView + "_" + currentTab);
		if (list == null) {
			for (String title : tabTiltes) {
				cache.put(currentView + "_" + title, new ArrayList<ProtectionEquipmentDTO>());
			}
			list = protectCheckQueryManager.getTransProtectIncorrectInfos();
			for (ProtectionEquipmentDTO d : list) {
				cache.get(currentView + "_" + d.getComment()).add(d);
			}
		}
		incorrectPro = cache.get(currentView + "_" + currentTab);
	}

	/**
	 * 查询变压器主保护错误的数据
	 * @return
	 */
	private void findIncorrectBreakerPro() {
		List<ProtectionEquipmentDTO> list = cache.get(currentView + "_" + currentTab);
		if (list == null) {
			for (String title : tabTiltes) {
				cache.put(currentView + "_" + title, new ArrayList<ProtectionEquipmentDTO>());
			}
			list = protectCheckQueryManager.getBreakerProtectIncorrectInfos();
			for (ProtectionEquipmentDTO d : list) {
				cache.get(currentView + "_" + d.getComment()).add(d);
			}
		}
		incorrectPro = cache.get(currentView + "_" + currentTab);
	}

	/**
	 * 查询未绑定变电站保护
	 * @return
	 */
	private void findUnbindStationPro() {
		List<ProtectionEquipmentDTO> list = cache.get(currentView + "_" + currentTab);
		if (list == null) {
			list = protectCheckQueryManager.getUnbindStationProtect();
			cache.put(currentView + "_" + currentTab, list);
		}
		incorrectPro = list;
	}

	/**
	 * 查询未绑定一次设备保护信息
	 * @return
	 */
	private void findUnbindPrimaryEquPro() {
		List<ProtectionEquipmentDTO> list = cache.get(currentView + "_" + currentTab);
		if (list == null) {
			list = protectCheckQueryManager.getUnbindPrimaryEquProtect();
			cache.put(currentView + "_" + currentTab, list);
		}
		incorrectPro = list;
	}

	/**
	 * 保护修正编辑
	 * @param event
	 */
	public void onCellEdit(CellEditEvent event) {
		for (ProtectionEquipmentDTO dto : incorrectPro) {
			if (dto.getId().equals(event.getRowKey())) {
				ProtectionEquipment pro = protectCheckPersistManager.findProtectById(dto.getId());
				pro.setType(dto.getType());
				pro.setDevType(dto.getDevType());
				protectCheckPersistManager.updateProtect(pro);
				addSuccessMessage("编辑成功！");
				break;
			}
		}
	}

	/**
	 * 刷新
	 */
	public void refresh() {
		cache.clear();
		if ("line".equals(currentView)) {
			findIncorrectLinePro();// 加载线路主保护错误的数据
		} else if ("bus".equals(currentView)) {
			findIncorrectBusPro();// 加载母线主保护错误的数据
		} else if ("power".equals(currentView)) {
			findIncorrectTransPro();// 加载变压器主保护错误的数据
		} else if ("breaker".equals(currentView)) {
			findIncorrectBreakerPro();// 加载断路器保护错误的数据
		} else if ("unbindSt".equals(currentView)) {
			findUnbindStationPro();// 加载未绑定变电站的保护
		} else if ("unbindEqu".equals(currentView)) {
			findUnbindPrimaryEquPro();// 加载未绑定一次设备的保护
		}
	}

	/**
	 * 导出并压缩下载Excel
	 */
	public void exportExcelZip() {
		final List<File> fileList = new ArrayList<File>();// 需要压缩的文件
		String filePath = pros.getExportTempPath();
		String fileName = "";
		String fileType = ".xls";
		Map<String, List<ProtectionEquipmentDTO>> commentType = new HashMap<String, List<ProtectionEquipmentDTO>>();// 组类型+数量，保护数据
		for (String typeName : selectedTypes) {
			List<String> headerList = new ArrayList<String>();// 表头
			List<String> fieldList = new ArrayList<String>();// 内容（表头所对应的entity中的属性），顺序和表头顺序一致
			List<String> mergeList = new ArrayList<String>();// 需要合并单元格的属性名（对应entity中的属性名）注：目前只支持合并前两行
			List<ProtectionEquipmentDTO> incorrectProEqu = null;
			if ("line".equals(typeName)) {
				headerList.add("设备名称");
				headerList.add("变电站名称");
				fieldList.add("protectedName");
				fieldList.add("substationName");
				fileName = "线路主保护错误数据";
				incorrectProEqu = protectCheckQueryManager.getLineProtectIncorrectInfos();
				mergeList.add("protectedName");
				mergeList.add("substationName");
			} else if ("bus".equals(typeName)) {
				headerList.add("变电站名称");
				headerList.add("设备名称");
				fieldList.add("substationName");
				fieldList.add("protectedName");
				fileName = "母线主保护错误数据";
				incorrectProEqu = protectCheckQueryManager.getBusProtectIncorrectInfos();
				mergeList.add("substationName");
				mergeList.add("protectedName");
			} else if ("power".equals(typeName)) {
				headerList.add("变电站名称");
				headerList.add("设备名称");
				fieldList.add("substationName");
				fieldList.add("protectedName");
				fileName = "变压器主保护错误数据";
				incorrectProEqu = protectCheckQueryManager.getTransProtectIncorrectInfos();
				mergeList.add("substationName");
				mergeList.add("protectedName");
			} else if ("breaker".equals(typeName)) {
				headerList.add("变电站名称");
				headerList.add("设备名称");
				fieldList.add("substationName");
				fieldList.add("protectedName");
				fileName = "断路器主保护错误数据";
				incorrectProEqu = protectCheckQueryManager.getBreakerProtectIncorrectInfos();
				mergeList.add("substationName");
				mergeList.add("protectedName");
			}
			headerList.add("保护名称");
			headerList.add("类型");
			headerList.add("保护型号");
			headerList.add("保护类型");
			headerList.add("保护厂家");

			fieldList.add("name");
			fieldList.add("type");
			fieldList.add("devType");
			fieldList.add("protectedType");
			fieldList.add("devManufacturer");
			for (ProtectionEquipmentDTO protEq : incorrectProEqu) {
				if (commentType.containsKey(protEq.getComment())) {
					List<ProtectionEquipmentDTO> protList = commentType.get(protEq.getComment());
					protList.add(protEq);
					commentType.put(protEq.getComment(), protList);
				} else {
					List<ProtectionEquipmentDTO> protList = new ArrayList<ProtectionEquipmentDTO>();
					protList.add(protEq);
					commentType.put(protEq.getComment(), protList);
				}
			}
			String storagePath = ExcelUtils.exportExcelReturnPath(commentType, headerList, fieldList, mergeList, filePath, fileName, fileType);
			if (storagePath != null) {
				File excelFile = new File(storagePath);
				fileList.add(excelFile);
			}
			commentType.clear();
		}
		if (fileList != null && fileList.size() > 0) {
			String zipName = "主保护错误数据";
			String zipType = ".zip";
			ZipUtil.zipFile(filePath + zipName + zipType, fileList);
			final File zipFile = new File(filePath + zipName + zipType);
			InputStream stream = null;
			try {
				stream = new FileInputStream(zipFile);
				protectFile = new DefaultStreamedContent(stream, "application/zip", URLEncoder.encode(zipName + zipType, "UTF-8"));
				addSuccessMessage("导出成功！");
				new Thread() {// 5s后删除文件
					@Override
					public void run() {
						try {
							Thread.sleep(5000);// 5s
							if (zipFile.exists() && zipFile.isFile()) {// 删除zip
								zipFile.delete();
							}
							if (fileList != null && fileList.size() > 0) {// 删除excel文件
								for (File excelFile : fileList) {
									if (excelFile.exists() && excelFile.isFile()) {
										excelFile.delete();
									}
								}
							}
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
					}
				}.start();
			} catch (FileNotFoundException | UnsupportedEncodingException e) {
				addErrorMessage("导出失败！");
				e.printStackTrace();
			}
		} else {
			addErrorMessage("导出失败！");
		}
	}

	/**
	 * 变电站
	 * @param query
	 * @return
	 */
	public List<String> completeStationNames(String query) {
		List<String> results = new ArrayList<String>();
		for (String s : cimstation.keySet()) {
			if (s.startsWith(query))
				results.addAll(cimstation.get(s));
		}
		return results;
	}

	/**
	 * 变电站选择
	 * @return
	 */
//	public void onProtectItemSelect(SelectEvent event) {
//		String pname = event.getObject().toString();
//		for (IdentifiedObject o : equipments) {
//			if (o.getName().toString().equals(pname)) {
//				selected.setProtectedId(o.getId());
//				addSuccessMessage("关联一次设备成功");
//				return;
//			}
//		}
//		addErrorMessage("关联一次设备失败");
//	}

	/**
	 * 一次设备名称
	 * @param query
	 * @return
	 */
	public List<String> completeEquipmentNames(String query) {
		List<String> results = new ArrayList<String>();
		for (String s : primEquipments.keySet()) {
			if (s.startsWith(query))
				results.addAll(primEquipments.get(s));
		}
		return results;
	}

	/**
	 * 查询变电站下的一次设备
	 */
	public void getEquipmentByStation() {

		String selectStation = null;// 选择的站
		if (selected != null) {

			selectStation = selected.getSubstationId();
		}
		Map<String, Object> options = new HashMap<String, Object>();
		options.put("resizable", true);
		options.put("draggable", true);
		options.put("modal", false);
		options.put("width", 600);
		options.put("height", 400);
		Map<String, List<String>> params = new HashMap<>();
		List<String> s = new ArrayList<>();
		s.add(selectStation);
		params.put("stationId", s);
		openDialog("/ui/common/equipment_selector_single",  params,options);
	}

	/**
	 * 设备选择对话框回调事件
	 * @param event
	 */
	public void onEquDialogChosenListener(SelectEvent event) {

		IdentifiedObject equipment = (IdentifiedObject) event.getObject();
		if (equipment != null && equipment instanceof PowerSystemResource) {

			PowerSystemResource pe = (PowerSystemResource) equipment;
			selected.setProtectedId(pe.getId());
			selected.setProtectedName(pe.getName());
		}
	}

	/**
	 * 生产厂家
	 * @param query
	 * @return
	 */
	public List<String> completeDevManufacturer(String query) {
		List<String> results = new ArrayList<String>();
		for (String s : devManufacturerMap.keySet()) {
			if (s.startsWith(query))
				results.addAll(devManufacturerMap.get(s));
		}
		return results;
	}

	/**
	 * 保存设备关联
	 */
	public void update() {

		if (selected != null) {

			ProtectionEquipment pre = new ProtectionEquipment();
			try {
				BeanUtils.copyProperties(pre, selected);
			} catch (IllegalAccessException | InvocationTargetException e) {
				e.printStackTrace();
			}
			protectCheckQueryManager.update(pre);
			incorrectPro.remove(selected);
			addSuccessMessage("保存成功");
		}
	}

	public List<ProtectionEquipmentDTO> getIncorrectPro() {
		return incorrectPro;
	}

	public void setIncorrectPro(List<ProtectionEquipmentDTO> incorrectPro) {
		this.incorrectPro = incorrectPro;
	}

	public ProtectionEquipmentDTO getSelected() {
		return selected;
	}

	public void setSelected(ProtectionEquipmentDTO selected) {
		this.selected = selected;
	}

	public ProtectionEquipmentDTO getCurrentDevicePro() {
		return currentDevicePro;
	}

	public void setCurrentDevicePro(ProtectionEquipmentDTO currentDevicePro) {
		this.currentDevicePro = currentDevicePro;
	}

	public List<String> getProKinds() {
		return proKinds;
	}

	public void setProKinds(List<String> proKinds) {
		this.proKinds = proKinds;
	}

	public StreamedContent getProtectFile() {
		return protectFile;
	}

	public void setProtectFile(StreamedContent protectFile) {
		this.protectFile = protectFile;
	}

	public String[] getSelectedTypes() {
		return selectedTypes;
	}

	public void setSelectedTypes(String[] selectedTypes) {
		this.selectedTypes = selectedTypes;
	}

	public String getCurrentView() {
		return currentView;
	}

	public void setCurrentView(String currentView) {
		this.currentView = currentView;
	}

	public List<String> getTabTiltes() {
		return tabTiltes;
	}

	public void setTabTiltes(List<String> tabTiltes) {
		this.tabTiltes = tabTiltes;
	}

	public List<Substation> getSubstations() {
		return substations;
	}

	public void setSubstations(List<Substation> substations) {
		this.substations = substations;
	}

	public Map<String, List<String>> getCimstation() {
		return cimstation;
	}

	public void setCimstation(Map<String, List<String>> cimstation) {
		this.cimstation = cimstation;
	}

	public String getDeviceName() {
		return deviceName;
	}

	public void setDeviceName(String deviceName) {
		this.deviceName = deviceName;
	}

	public List<String> getProtectedTypes() {
		return protectedTypes;
	}

	public void setProtectedTypes(List<String> protectedTypes) {
		this.protectedTypes = protectedTypes;
	}
}
